# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=restinio
pkgver=0.6.17
pkgrel=6
pkgdesc="Header-only C++14 library that gives you an embedded HTTP/Websocket server"
url="https://stiffstream.com/en/products/restinio.html"
arch="noarch"
license=" BSD-3-Clause"
makedepends="cmake openssl-dev zlib-dev pcre2-dev boost-dev fmt-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/Stiffstream/restinio/releases/download/v.$pkgver/restinio-$pkgver.tar.bz2
	lfs64.patch
	"
options="!check" # cant get checks to work

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja -S dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DRESTINIO_FIND_DEPS=ON \
		-DRESTINIO_TEST=OFF \
		-DRESTINIO_SAMPLE=OFF \
		-DRESTINIO_INSTALL_SAMPLES=OFF \
		-DRESTINIO_BENCH=OFF \
		-DRESTINIO_INSTALL_BENCHES=OFF \
		-DRESTINIO_ALLOW_SOBJECTIZER=OFF \
		-DRESTINIO_USE_EXTERNAL_HTTP_PARSER=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	  DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
be6f2ccfbeb9840391adfd2e8416b5a0511ac1e47b79038e9296ec5ec9a75c708ece23d9204f5dc0e753f62b950b8410262af2504812f19bbbefcc5cc057b5a1  restinio-0.6.17.tar.bz2
a26b26275c76d720d2502b20d431e7990b42c7f3cae94b4a17521718ee9c9abf0b625e19286d12c53f61a058fd83129428e8a90a0f6c8ab8ad5a142b7ae4fb47  lfs64.patch
"
